package array;

public class ArrayDemo3 {
    public static void main(String[] args) {
        //创建一个数组对象
        int[] arr1 = {1, 2, 3, 4, 5};
        System.out.println("arr1 = " + arr1);
        for (int i = 0; i < arr1.length; i++) {
            System.out.println("arr1[" + i + "] = " + arr1[i]);
        }
        //创建一个数组
        int[] arr2 = arr1;//
        //对arr2数组中的元素做修改
        arr2[0] = 111;
        arr2[1] = 222;
        System.out.println("arr2 = " + arr2);
        //遍历arr2
        for (int i = 0; i < arr2.length; i++) {
            System.out.println("arr2 =["+i+"]= " + arr2[i]);

        }
        //遍历arr1
        for (int i = 0; i < arr1.length; i++) {
            System.out.println("arr1["+i+"] = " + arr1[i]);

        }

    }
}
